home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Information
/
WebSites
/
Wirenet
/
files
/
Dashboard2.lha
/
Dashboard2
/
AmiTCP
/
bin
/
WirenetPrefs
< prev
Wrap
Text File
|
1998-04-23
|
5KB
|
172 lines
/*
$VER: WirenetPrefs 2.0 (17.4.98)
(c) Neil Bothwick
Manages Wirenet preferences settings
*/
options results
address command
/* ;;; Initialise */
Usage = 'Usage: WirenetPrefs Load|Save|Use|Show|Flush|Copy|Convert'
PrefsFile = 'ENV:Wirenet.prefs'
PrefNames = 'WWW FTP ButtonA ButtonB NodeName DomainName UserName MailBox IPAddress Password'
PrefNames = PrefNames 'DialWindow Gateway ModemDev ModemDial ModemInit ModemSpeed MTU PopNum'
PrefNames = PrefNames 'PPPoptions UsePAP TCPstack MailServer NewsServer SMTPServer'
PrefNames = PrefNames 'AminetServer DownloadDir AminetRoot GetReadme NewsSockets MaxTries'
lf = '0a'x
;;;
/* ;;; Select option */
parse arg args
args = upper(args)
select
when args = 'LOAD' then call LoadPrefs()
when args = 'USE' then call UsePrefs()
when args = 'SAVE' then call SavePrefs()
when args = 'SHOW' then call ShowPrefs()
when args = 'COPY' then call CopyPrefs()
when args = 'FLUSH' then call FlushPrefs()
when args = 'CONVERT' then call ConvPrefs()
otherwise ExitMsg(Usage)
end
exit
;;;
/* ;;; Exit with message */
ExitMsg:
parse arg msg
call rtezrequest(msg,' OK ','Wirenet Prefs','rt_reqpos = reqpos_centerscr')
exit
return
;;;
/* ;;; Load preferences */
LoadPrefs:
call FlushPrefs()
Names = ''
Values = ''
if ~open(prefs,PrefsFile,'R') then call ExitMsg('Failed to read preferences file')
do until eof(prefs)
line = readln(prefs)
if line = '' then iterate
if pos(left(line,1),';#') > 0 then iterate
parse var line name ':' value
value = strip(value)
call setclip(name,value)
end
call setclip('HostName',getclip('NodeName')||getclip('DomainName'))
call setclip('WirenetPrefs','TRUE')
'setenv IPADDRESS' getclip('IPAddress')
'setenv NODENAME' getclip('NodeName')
'setenv DOMAINNAME' getclip('DomainName')
'setenv HOSTNAME' getclip('HostName')
'setenv HOST' getclip('NodeName')||getclip('DomainName')
'setenv USERNAME' getclip('UserName')
'setenv USER' getclip('UserName')
return
;;;
/* ;;; Use Preferences */
UsePrefs:
if ~open(prefs,PrefsFile,'W') then call ExitMsg('Failed to save preferences')
call writeln(prefs,'# Wirenet preferences file')
do i = 1 to words(PrefNames)
name =word(PrefNames,i)
call writeln(prefs,name':' getclip(name))
end
call close(prefs)
return
;;;
/* ;;; Save Preferences */
SavePrefs:
call UsePrefs()
'copy >NIL:' PrefsFile 'ENVARC:'
return
;;;
/* ;;; Show Preferences */
ShowPrefs:
do i = 1 to words(PrefNames)
name =word(PrefNames,i)
say left(name': ',20)'"'getclip(name)'"'
end
return
;;;
/* ;;; Copy preferences to Dashboard */
CopyPrefs:
if getclip('WirenetPrefs') ~= 'TRUE' then call LoadPrefs()
/* Make sure Gui4Cli is running */
if show('P','Gui4Cli') = 0 then do
call ExitMsg('Dashboard must be running'lf'to use the Copy option')
exit
end
address 'Gui4Cli'
'DelVar Dashboard/PrefsRead'
Values = ''
Names = ''
do i = 1 to words(PrefNames)
'SetVar Dashboard/'word(PrefNames,i) '"'getclip(word(PrefNames,i))'"'
end
'SetVar Dashboard/PrefsRead 1'
return
;;;
/* ;;; Flush preferences */
FlushPrefs:
do i = 1 to words(PrefNames)
call setclip(word(PrefNames,i))
end
return
;;;
/* ;;; Convert preferences*/
/* Converts old env var based preferences */
ConvPrefs:
if exists(PrefsFile) then do
'copy >NIL:' PrefsFile PrefsFile'.bak clone'
'copy >NIL:' PrefsFile'.bak ENVARC: clone'
end
call FetchVar('NodeName','NODENAME')
call FetchVar('DomainName','DOMAINNAME')
call FetchVar('UserName','USERNAME')
call FetchVar('MailBox','MAILBOX')
call FetchVar('IPAddress','IPADDRESS')
call FetchVar('DialWindow','Wirenet/DialWindow')
call FetchVar('Gateway','Wirenet/Gateway')
call FetchVar('ModemDev','Wirenet/ModemDev')
call FetchVar('ModemDial','Wirenet/ModemDial')
call FetchVar('ModemInit','Wirenet/ModemInit')
call FetchVar('ModemSpeed','Wirenet/ModemSpeed')
call FetchVar('MTU','Wirenet/MTU')
call FetchVar('PopNum','Wirenet/PopNum')
call FetchVar('PPPoptions','Wirenet/ppp.options')
call FetchVar('MailServer','MAILSERVER')
call FetchVar('NewsServer','NEWSSERVER')
call FetchVar('SMTPServer','SMTPSERVER')
call FetchVar('AminetServer','FTPSERVER')
call FetchVar('DownloadDir','FTPDIR')
call FetchVar('AminetRoot','FTPROOT')
if exists('ENVARC:Wirenet/pap.config') then call setclip('Password',word(GetVar('ENVARC:Wirenet/pap.config'),2))
call setclip('UsePAP',exists('ENV:Wirenet/UsePAP'))
call setclip('TCPstack',exists('ENV:Wirenet/UseMiami'))
call setclip('GetReadme',exists('ENV:FTPREADME'))
call setclip('NewsSockets',3)
call setclip('MaxTries',5)
call setclip('WWW','AWeb3:Aweb')
call setclip('FTP','Wirenet:AmiFTP')
call setclip('ButtonA','User A')
call setclip('ButtonB','User B')
call SavePrefs()
return
/* Reads environment variable into clip, with default */
FetchVar:
clip = arg(1)
env = arg(2)
def = arg(3)
if exists('ENV:'env) then val = GetVar(env)
else val = def
call setclip(clip,val)
return
;;;